﻿Imports Microsoft.Win32

''' <summary>
''' Action for saving a ScriptAction.
''' </summary>
''' <remarks></remarks>
''' <editHistory></editHistory>
Public Class SaveAction

    Public Shared Function CanExecute(ByVal scriptProject As ScriptProject) As Boolean
        Return scriptProject IsNot Nothing
    End Function

    ''' <summary>
    ''' Saves the specified project
    ''' </summary>
    ''' <param name="scriptProject"></param>
    ''' <remarks></remarks>
    Public Shared Sub Execute(ByVal scriptProject As ScriptProject, ByVal filename As String)

        If scriptProject Is Nothing Then Throw New ArgumentNullException("scriptProject")
        If String.IsNullOrEmpty(filename) Then Throw New ArgumentException("filename is null or empty", "filename")

        'Save the project
        scriptProject.Save(filename)
    End Sub

End Class
